(C++) Check for use of invalidated iterators.